package com.softgroup.breath.easyecgproject.myapi;

/**
 * Created by Administrator on 2017/7/13.
 */

public class EcgCount {
    public static float getV(int data) {
        float a = (float) (data - 8388608) * 4800f;
        float y = (float) (a / 16777215 / 6f);
        return y;
    }

    public static int getPower(int data) {
        int power = (data - 37250) / 50;
        if (power < 0) {
            return 0;
        } else if (power > 100) {
            return 100;
        } else return power;
    }

    public static String getAnimalHeat(int animalHeat) {
        float v = animalHeat * 2.48f / 8388608;
        float r = v * 10000 / (2.48f - v);
        return String.format("%.2f", 62.35f - (0.84f * r / 1000));
    }
}
